<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .p {
        width: 200px;
        height: 200px;
        background: red;
    }

    .c {
        width: 100px;
        height: 100px;
        background: deepskyblue;
    }
</style>

<body>
<div id="app">
    <input type="text" @keydown.enter="keydown">
</div>
</body>

</html>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->
<script>
    ///如果希望可以通过特定的按键触发事件,那么可以直接用键盘的字母作为按键的修饰符就可以了
    let vm = new Vue({

        methods: {
            keydown() {
                console.log('keydown')
            }
        }

    }).$mount('#app')
</script>